package test.pcs;

import com.payment.lc.pcs.client.wrap.bo.ProductionPurchaseAttributes;
import com.payment.lc.pcs.client.wrap.service.ProductionWrapService;
import com.payment.lc.pcs.common.enums.BizType;
import com.payment.lc.pcs.common.util.DateUtil;
import com.payment.lc.pcs.service.api.DynamicDataService;
import com.payment.lc.pcs.service.api.ProductionService;
import com.payment.lc.pcs.service.api.modify.PcsChannelService;
import com.payment.lc.pcs.service.bo.ProductionSellInfoV2;
import com.payment.lc.pcs.service.domain.ListWrapper;
import com.payment.lc.pcs.service.domain.ProductionBizInfo;
import com.payment.lc.pcs.service.domain.ProductionLimit;
import com.payment.lc.pcs.service.domain.ProductionLimitFrame;
import com.payment.lc.pcs.util.DateComputeUtil;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import test.BaseTest;

import java.util.Date;
import java.util.List;

/**
 * Created on 2016/8/8.
 */
public class Demo4Test2 extends BaseTest {

    @Autowired
    ProductionService productionService;
    @Autowired
    DateComputeUtil dateComputeUtil;
    @Autowired
    DynamicDataService dynamicDataService;
    @Autowired
    ProductionWrapService productionWrapService;
    @Autowired
    PcsChannelService pcsChannelService;

    @Test
    public void test() throws Exception {
        pcsChannelService.syncProdDynaValue("PA9035");
    }

    void test2() throws Exception {
        ProductionPurchaseAttributes purchaseAttributes = productionWrapService.getProductionPurchaseAttributes(productionWrapService.getProduction("PA9035"));
        display(purchaseAttributes);
    }
    void test3() throws Exception {
        ProductionSellInfoV2 sellInfoV2 = dynamicDataService.getProductionSellInfoV2("PA9035");
        display(sellInfoV2);
    }
    void test1() throws Exception {
        ListWrapper<ProductionLimit> limit = productionService.getLimit("PA9035", BizType.Fundin);
        display(limit);

        List<ProductionLimitFrame> usefulLimitFrames =
                limit.getList().get(0).getUsefulLimitFrames(DateUtil.parseDate("20180503 23:59:59", "yyyyMMdd HH:mm:ss"));
        display(usefulLimitFrames);

        usefulLimitFrames =
                limit.getList().get(0).getUsefulLimitFrames(DateUtil.parseDate("20180504 23:59:59", "yyyyMMdd HH:mm:ss"));
        display(usefulLimitFrames);
        usefulLimitFrames =
                limit.getList().get(0).getUsefulLimitFrames(new Date());
        display(usefulLimitFrames);
    }

}